package com.learn.spring;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class HelloWord {
    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        HelloWord helloWord = (HelloWord) ctx.getBean("helloWord");
        helloWord.hello();

    }

    int id;
    String userName;

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public void setId(int id){
        this.id = id;
    }

    public void hello(){
        System.out.println(userName);
    }

    @Override
    public String toString() {
        return "HelloWord{" +
                "id=" + id +
                ", userName='" + userName + '\'' +
                '}';
    }
}
